package ui.activity.profit.presenter;


import javax.inject.Inject;

import base.BaseBiz;
import ui.activity.profit.biz.ProfitDetailsBiz;
import ui.activity.profit.contract.ProfitDetailsContract;
import ui.model.ProfitDetailsBean;

/**
 * Created by chenjian on 19/2/26
 */

public class ProfitDetailsPresenter implements ProfitDetailsContract.Presenter {

    ProfitDetailsContract.View view;
    ProfitDetailsBiz profitDetailsBiz;


    @Inject
    public ProfitDetailsPresenter(ProfitDetailsContract.View view) {
        this.view = view;
    }


    @Override
    public void setBiz(BaseBiz biz) {
        profitDetailsBiz = (ProfitDetailsBiz) biz;
    }


    @Override
    public void getInfo(String customId, String strData) {
        view.loading(true);
        profitDetailsBiz.GetInComeDetail(customId, strData, new BaseBiz.Callback<ProfitDetailsBean>() {
            @Override
            public void onSuccess(ProfitDetailsBean info) {
                view.upDateUI(info);
                view.loading(false);
            }

            @Override
            public void onFailure(ProfitDetailsBean info) {
                view.loading(false);
            }
        });
    }

    @Override
    public void toUpdateVisibility(int type) {
        view.upDateVisibility(type);
    }
}
